<?php

namespace app\pc\controller;
use app\base\controller\Base;
use think\Request;
use think\Cache;
use think\Config;
use think\Session;



class Protocol extends Base
{
    public  $model;

    public function __construct()
    {
   $this->model = model("Protocol");
        parent::__construct();
        $rows = Cache::get($this->Cstatic->get("sid"));
        $this->sid_user_id = $rows['id'];
        $this->sid_mobile = $rows['mobile'];
    }

    public function read($id){
        $idss = $this->idss;
        $idss = explode(",",$idss);

        if(!empty($idss)){
            $res = [];
            foreach($idss as $k=>$v){
                $result_  = $this->model->where(['id'=>$v])->find();
                if(!empty($result_)){
                    $res[] = $result_->toArray();
                }
            }

            if(empty($res)){
                return   resJson(1,"查询失败");
            }

            return   sucessJson("查询成功",$res);
        }
        return   resJson(0,"异常");
    }


    //获取合同
    public function getcompact(){

        $res = $this->model->where("type",2)->where('is_position',1)->find();

        if(empty($res)){

            return   resJson(1,"查询失败");

        }
      $res['content'] =stripslashes(htmlspecialchars_decode($res['content']));

        return   sucessJson("查询成功",$res);
    }






}
